clc
clear all
close all
TotalAccuracy = [];
TotalMSE = [];

for i =2:2
    mode=2;
    switch mode
        case 1
            n=8;
            Default =0;
            %分类用数据集
            %filename数数据集文件名，value_interval特征值选定范围，输出为数据集和标签
            filename='MergeBinderDataSet_Total.csv';
            value_interval_new=[26,5,7:13,27,28];
            [x_train,y_train,x_test,y_test,timestamps,y]=TrainTestDataSet(filename,value_interval_new,i);

%             %回归用数据集
%             %filename数数据集文件名，value_interval特征值选定范围，输出为数据集和标签
%             filename='MergeBinderDataSet_Total.csv';
%             value_interval_new=[2,5,7:13,27,28];
%             [x_train,y_train,x_test,y_test,timestamps,y]=TrainTestDataSet(filename,value_interval_new,i);

            switch n
                case 1
                    [y_predict,accuracy]=SVM(x_train,y_train,x_test,y_test,Default);
                case 2
                    [y_predict,accuracy] = EnsembleC(x_train,y_train,x_test,y_test,Default);
                case 3
                     [y_predict,accuracy] = KNNC(x_train,y_train,x_test,y_test,Default);
                case 4
                    [y_predict,MSE] = EnsembleR(x_train,y_train,x_test,y_test,Default);
                case 5
                    [y_predict,MSE] = SVMR(x_train,y_train,x_test,y_test,Default);
                case 6
                    [y_predict,MSE] = KNN5(x_train,y_train,x_test,y_test,Default);
            end
        case 2
            Default =1;
            y = [];
            TempAccuracy = [];
            TempMSE = [];

            %分类用数据集
            %filename数数据集文件名，value_interval特征值选定范围，输出为数据集和标签
            filename='MergeBinderDataSet_Total.csv';
            %[5,7:13,26]你把这几个量在仿真的模型程序里提取出来，然后按照同样的方法把新变量[27\28\29]生成出来
            value_interval_new=[27,5,7:13,26,28,29];
            [x_train,y_train,x_test,y_test,timestamps]=TrainTestDataSet(filename,value_interval_new,i);

            [y_predict,accuracy]=SVM(x_train,y_train,x_test,y_test,Default);
            y=[y y_predict];
            TempAccuracy(1) = accuracy;

            [y_predict,accuracy] = KNNC(x_train,y_train,x_test,y_test,Default);
            y=[y y_predict];
            TempAccuracy(2) = accuracy;

            [y_predict,accuracy] = EnsembleC(x_train,y_train,x_test,y_test,Default);
            y=[y y_predict];
            TempAccuracy(3) = accuracy;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            [y_predict,MSE] = KNN5(x_train,y_train,x_test,y_test,Default);
            y=[y y_predict];
            TempMSE(3) = MSE;

            y_test = y_test+x_test(:,1);
            y_train = y_train + x_train(:,1);

            [y_predict,MSE] = EnsembleR(x_train,y_train,x_test,y_test,Default);
            y=[y y_predict];
            TempMSE(1) = MSE;

            [y_predict,MSE] = SVMR(x_train,y_train,x_test,y_test,Default);
            y=[y y_predict];
            TempMSE(2) = MSE;

            TotalAccuracy(i,:) = TempAccuracy;
            TotalMSE(i,:) = TempMSE;
%             y = vote(y);
    end
end